1. Field of the Invention
The present invention generally relates to Computer Aided Software Engineering (CASE) and, more particularly, a method for automatically generating adapter classes that convert output from a source object to input of a target object.
2. Background Description
Object oriented programming (OOP) is the preferred environment for building user-friendly, intelligent computer software. Key elements of OOP are data encapsulation, inheritance and polymorphism. These elements may be used to generate a graphical user interface (GUI), typically characterized by a windowing environment having icons, mouse cursors and menus. While these three key elements are common to OOP languages, most OOP languages implement the three key elements differently.
Examples of OOP languages are Smalltalk, Object Pascal and C++. Smalltalk is actually more than a language; it might more accurately be characterized as a programming environment. Smalltalk was developed in the Learning Research Group at Xerox""s Palo Alto Research Center (PARC) in the early 1970s. In Smalltalk, a message is sent to an object to evaluate the object itself. Messages perform a task similar to that of function calls in conventional programming languages. The programmer does not need to be concerned with the type of data; rather, the programmer need only be concerned with creating the right order of a message and using the right message. Object Pascal is the language used for Apple""s Macintosh(copyright) computers. Apple developed Object Pascal with the collaboration of Niklaus Wirth, the designer of Pascal. C++ was developed by Bjarne Stroustrup at the ATandT Bell Laboratories in 1983 as an extension of C. The key concept of C++ is class, which is a user-defined type. Classes provide object oriented programming features. C++ modules are compatible with C modules and can be linked freely so that existing C libraries may be used with C++ programs. The most widely used object based and object oriented programming languages trace their heritage to Simula developed in the 1960s by O-J. Dahl, B. Myhrhaug and K. Nygard of Norway. Further information on the subject of OOP may be had by reference to Object Oriented Design with Applications by Grady Booch, The Benjamin/Cummings Publishing Co., Inc., Redwood City, Calif. (1991).
Rapid Application Design (RAD) tools, such as Microsoft""s Visual Basic, offer a way to produce a software application in a relatively short period of time. Typically, RAD tools are used to generate the xe2x80x9clook and feelxe2x80x9d of an application, but the code generated by these tools are generally slow in execution. Therefore, many software houses prototype the Graphic User Interface (GUI) of their applications in a RAD tool and then implement the application in C++.
Despite the benefits of object-oriented program development, implementing large applications in, for example, C++ can be expensive. One approach to reducing the cost is to reuse object implementations. Object Oriented Programming (OOP) languages provide some degree of reuse. OOP is about describing how objects interact with one another. Component Object Programming (COP) is designed to produce reusable units of software. COP use building blocks for constructing custom software. Unlike OOP objects, COP hides details above the object-interaction level. There is no inheritance between components, although the objects that make up the component may inherit behavior from other objects, possibly in other components. In other words, when using a component, the inner workings of that component are oblivious to the application using the component. The component always appears as a single interface which formalizes properties, events and behavior. As a result of its well defined interface, a component may be easily reused. Components are to software what integrated circuits (ICs) are to electronics; they encapsulate function and provide services based on a strict specification of their interface. For example, a spell-check component encapsulates the minimum knowledge to completely perform its task. Thus, by combining components, large software applications can be built.
An advantage of COP is an additional level of modularity on top of what OOP already offers. The focus is on how entire sets of functionalities interact. OOP does not encapsulate groups of classes and objects. COP hides the information at the class level. Sun Microsystems"" JavaBeans is a component architecture for the cross-platform Java programming language.
To illustrate this point, consider how the component model of programming used in Java and other object oriented programming environments assembles applications by binding or wiring together objects (components) which are generally obtained from a wide variety of component libraries.
Most often these components do not have the specific function necessary for direct wiring. This functionality is missing because components are obtained from different sources with different functionality and implementation, and because it would be wasteful to implement the incredibly wide variety of functionality available for each and every object in a library.
Therefore, components are wired by an adapter object which converts an output from the source object to an input of the target object. Present methodology requires production of adapter class source code either by the Integrated Development Environment (IDE) tool, by the wiring tool, or by hand coding.
This source code is then compiled and the adapter classes are included in the application. Most adapter classes follow a predictable pattern and can be dynamically generated and wired to their source and target objects at program execution (run) time rather than at development time. The delay in binding adapter classes to the application provides an opportunity for reducing the load time and size of applications, customizing the adapter classes for functionality, and tuning the adapter classes to optimize application performance.
The use of automatic dynamic adapter class generation will become even more important as the component model and component wiring tools are further developed and become a greater part of the worldwide application development effort.
It is therefore an object of the present invention to dynamically generate and load adapter classes, without human intervention, that convert output from a source object to an input to a target object.
The invention does not require generation of adapter source code by either the IDE or the programmer. Nor is a compiler required. Executable storage space is also reduced since storing adapter classes in the application executable is not required. Adapter classes and objects are automatically and dynamically generated as required while the application loads and runs. The classes and objects need only exist at the time that a running application calls for the adapter classes, and can be dynamically modified or exchanged in order to optimize the running application or modify application functionality. xe2x80x9cEvent to Methodxe2x80x9d adapter classes and objects are automatically and dynamically generated and wired to source and target objects as required using, for example, the Beans Markup Language (BML) runtime environments.
Since classes are generated directly, a compiler is not required. In the runtime environment of present development systems, there is no dynamic adapter generation. In the present invention, dynamic classes are directly generated, and therefore do not need to be included in the application executable. Also, the ability to provide for xe2x80x9clate bindingxe2x80x9d of application components provides additional flexibility of adapter class functionality. The invention thus provides for smaller load and execution sizes by delaying adapter generation until demanded by the application. Also, since adapter byte code is generated directly, neither an integrated development environment or compiler is required. Finally, this invention provides possible runtime flexibility in generation, use and reuse of adapter classes, and possible runtime optimization of application memory size and execution speed through adapter class functionality and usage.
Development environments from text editors to IDE""s including Visual builders generate source code either automatically or by hand coding. They do not generate executable code.